﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

public partial class Control_ChangePassword : System.Web.UI.UserControl
{
    private MatchIns.Model.TMemberLogin _userInfo;
    public MatchIns.Model.TMemberLogin UserInfo
    {
        set
        {
            _userInfo = value;
        }
        get
        {
            return this._userInfo;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void save_Click(object sender, EventArgs e)
    {
        MatchIns.BLL.TMemberLogin bllMember =  new MatchIns.BLL.TMemberLogin();
        MatchIns.Model.TMemberLogin member =bllMember.GetModel(UserInfo.UserID);
        //判断密码输入是否正确
        if (member.Password != System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(tbOldPwd.Text.Trim(), "MD5"))
        {
            info.Text = "×旧密码输入有误";
            return;
        }
        
        member.Password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(tbNewPwd.Text.Trim(), "MD5");
        bllMember.Update(member);
        info.Text = "<span style='color:green'>√密码修改成功</span>";
    }
}
